package xmlparser.dreamcoder.com.asimplexmlparser;

import android.app.Activity;
import android.os.Bundle;

import java.util.List;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<persons>\n" +
                "  <bookbean id=\"1\">\n" +
                "    <name>zhangsan</name>\n" +
                "    <price>21</price>\n" +
                "\t<publish>12</publish>\n" +
                "  </bookbean>\n" +
                "  <bookbean id=\"2\">\n" +
                "    <name>lisi</name>\n" +
                "    <price>22</price>\n" +
                "\t<publish>12</publish>\n" +
                "  </bookbean>\n" +
                "  <bookbean id=\"3\">\n" +
                "    <name>wangwu</name>\n" +
                "    <price>222</price>\n" +
                "\t<publish>12</publish>\n" +
                "  </bookbean>\n" +
                "</persons>";
        ASimpleXMLParser<BookBean> xmlParser = new ASimpleXMLParser<BookBean>(xml,BookBean.class);
        List<BookBean> bookBeans = xmlParser.execute();
        for (BookBean bookBean : bookBeans) {
            System.out.println(bookBean);
        }
    }

}
